package com.pomelo.kill.controller;

import com.pomelo.kill.common.AjaxResult;
import com.pomelo.kill.model.Goods;
import com.pomelo.kill.service.GoodsService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/goods")
public class GoodsController {

    @Resource
    private GoodsService goodsService;

    /**
     * 查询所有商品信息
     */
    @RequestMapping("/list")
    public AjaxResult list() {
        List<Goods> list = goodsService.selectAll();
        return list == null ? AjaxResult.failure("查询失败") : AjaxResult.success(list);
    }

}
